

using System;

namespace NodeBasedSkillEditor.Model.Node.RT
{
    public class Node_Tangent_RT : RT_Node
    {
        public RT_SingleValuePort Radian_RT;

        public RT_SingleValuePort Tangent_RT;

        public Node_Tangent_RT(Node_Tangent sourceData, RT_DAG parentDag) : base(sourceData, parentDag)
        {
            Radian_RT = new RT_SingleValuePort(EPortIOType.Input, sourceData.Radian, this);

            Tangent_RT = new RT_SingleValuePort(EPortIOType.Output, sourceData.Tangent, this);
            Tangent_RT.OnGetValue = GetTangent;
        }

        public AValue GetTangent(DAG_Executor executor)
        {
            float radian = Radian_RT.GetValue(executor).ToScalar().Item2;
            float result = MathF.Tan(radian);
            Tangent_RT.SourceValue.SetScalar(result);
            return Tangent_RT.SourceValue;
        }
    }
}